package com.alibaba.controller;

import com.alibaba.feign.CouponService;
import com.alibaba.pojo.CouponBean;
import com.alibaba.vo.ResultPageVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("coupon1")
public class CouponController {

    @Autowired
    private CouponService couponService;

    @GetMapping("ResultPageVo")
    @ResponseBody
    public ResultPageVo ResultPageVo(){
        ResultPageVo resultPageVo = new ResultPageVo();
        Page<CouponBean> couponBeanIPage =couponService.queryCouponPage();
        resultPageVo.setTotal(couponBeanIPage.getTotal());
        resultPageVo.setRows(couponBeanIPage.getRecords());
        return resultPageVo;
    }

    @GetMapping("show")
    public String show(){
        return "show";
    }

    @GetMapping("index")
    public String index(){
        return "index";
    }
}
